package com.sci.controller;

import com.sci.entity.User;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("user")
public class UserController {

    private static final Logger logger = LoggerFactory.getLogger(UserController.class);

    @Value("${server.port}")
    private int serverPort;

    @GetMapping("/{id}")
    public User getUser(@PathVariable(value = "id") Integer id) {
        logger.info("服务正在端口: {} 上运行", serverPort);

        User user = new User();
        user.setId(id);
        user.setName("小明");
        user.setPhoneNumber("1388888888");
        return user;
    }
}
